using I2.Loc;
using UnityEngine;

public class GameModeSelectUI : MonoBehaviour
{
	[SerializeField]
	private GameObject standartSelect;

	[SerializeField]
	private GameObject transportSelect;

	[SerializeField]
	private GameObject gameModePanel;

	[SerializeField]
	private UILabel mainLable;

	[SerializeField]
	private UILabel descriptionLable;

	[SerializeField]
	private UILabel countPlayerLable;

	[SerializeField]
	private LikeModeButton likeButton;

	[SerializeField]
	private LeaderBoardUI leaderBoardController;

	[SerializeField]
	private GameTypePreviewInLeaderBoard gameTypePreviewInLeaderBoard;

	public void Show(SelectableButtonMode selectModeButton)
	{
		gameModePanel.SetActive(false);
		base.gameObject.SetActive(true);
		mainLable.text = selectModeButton.ModeInfo.GetTranslateName()[LocalizationManager.CurrentLanguage];
		SetBottomPanel(selectModeButton);
		if (selectModeButton.ModeInfo.typeTransport == GameModesUI.TransportType.none)
		{
			standartSelect.SetActive(true);
		}
		else
		{
			transportSelect.SetActive(true);
		}
		leaderBoardController.GameTypePreviewInLeaderBoard = gameTypePreviewInLeaderBoard;
		likeButton.GameTypePreviewInLeaderBoard = gameTypePreviewInLeaderBoard;
		leaderBoardController.Show(selectModeButton);
	}

	public void Exit()
	{
		base.gameObject.SetActive(false);
		gameModePanel.SetActive(true);
		standartSelect.SetActive(false);
		transportSelect.SetActive(false);
	}

	public void Play()
	{
		gameModePanel.GetComponent<GameModesUI>().StartMode();
	}

	private void SetBottomPanel(SelectableButtonMode selectModeButton)
	{
		countPlayerLable.text = selectModeButton.ModeInfo.playerCount;
		descriptionLable.text = ScriptLocalization.Get("Game_Common/sm_" + selectModeButton.ModeInfo.name + "_info");
		likeButton.ButtonMode = selectModeButton;
		likeButton.RefreshView();
	}
}
